﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Uaf.Core.Commands
{
	public class CommandLocation
	{
		public string Parent
		{
			get;
			protected set;
		}

		public CommandLocationMethod Method
		{
			get;
			protected set;
		}

		public string Target
		{
			get;
			protected set;
		}

		public CommandLocation(string parent)
		{
			if (string.IsNullOrEmpty(parent))
				throw new ArgumentNullException("parent");
			Parent = parent;
			Method = CommandLocationMethod.End;
		}

		public CommandLocation(string parent, CommandLocationMethod method)
		{
			if (string.IsNullOrEmpty(parent))
				throw new ArgumentNullException("parent");
			if (method != CommandLocationMethod.Begin && method != CommandLocationMethod.End)
				throw new ArgumentException("method");

			Parent = parent;
			Method = method;
		}

		public CommandLocation(string parent, CommandLocationMethod method, string target)
		{
			if (string.IsNullOrEmpty(parent))
				throw new ArgumentNullException("parent");
			if (string.IsNullOrEmpty(target))
				throw new ArgumentNullException("target");
			if (method != CommandLocationMethod.Before && method != CommandLocationMethod.After)
				throw new ArgumentException("method");

			Parent = parent;
			Method = method;
			Target = target;
		}
	}
}
